package com.gxar.quick.ar.server.base.model.exchange.mapper;

import com.gxar.quick.ar.server.base.model.exchange.vo.response.AdminExchangeItemTransferPageResponse;
import com.gxar.quick.ar.server.db.model.ExchangeItemTransferRecordEntity;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * @author linsy
 * @version 1.0
 * @created 2024/2/29 16:48
 */
@Mapper
public interface ExchangeItemRecordMapstruct {

    ExchangeItemRecordMapstruct INSTANCE = Mappers.getMapper(ExchangeItemRecordMapstruct.class);

    /**
     * 实体转分页响应
     *
     * @param entity 实体
     * @return 响应
     */
    @Mapping(target = "id", expression = "java(String.valueOf(entity.getId()))")
    AdminExchangeItemTransferPageResponse entityToPageResponse(ExchangeItemTransferRecordEntity entity);

    /**
     * 实体转分页响应
     *
     * @param entityList 实体
     * @return 响应
     */
    List<AdminExchangeItemTransferPageResponse> entitiesToPageResponses(List<ExchangeItemTransferRecordEntity> entityList);

}
